<!--
 * @Author: your name
 * @Date: 2021-08-27 10:38:39
 * @LastEditTime: 2021-08-31 14:10:57
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \bigdate\src\setting\Icons\index.vue
 图标库：https://simpleicons.org/?q=edg
-->

<template>
    <svg
        :class="svgClassFun"
        aria-hidden="true"
        :style="{ width: size + 'em', height: size + 'em' }"
    >
        <use :xlink:href="iconNameFun" :fill="color" />
    </svg>
</template>
<!-- 如果更改图标获取删除图标直接在assets/svg下操作  -->

<script lang="ts">
import { defineComponent, computed } from 'vue'

export default defineComponent({
    name: 'SvgIcon',
    props: {
        iconClass: {
            type: [Number, String],
        },
        className: {
            type: [Number, String],
        },
        color: {
            type: String,
        },
        size: {
            type: [Number, String],
        },
    },
    setup(props) {
        let { iconClass, className } = props
        const iconNameFun = computed(() => `#icon-${iconClass}`)
        const svgClassFun = computed(() => {
            if (className) {
                return 'svg-icon ' + className
            } 
            return 'svg-icon'
        })
        return {
            iconNameFun,
            svgClassFun,
        }
    },
})
</script>
<style lang="less" scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
}
</style>
